package com.qq.springcloud.Service.impl;

import com.qq.springcloud.Service.IMessageProvider;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.MessageChannel;

import javax.annotation.Resource;

import java.util.UUID;

/**
 * @ClassName IMessageProviderService
 * @Description TODO
 * Author yangqinglin
 * @Date 2020/12/2 19:07
 * @Version
 **/

@EnableBinding(Source.class)
public class IMessageProviderImpl implements IMessageProvider {

    @Resource
    private MessageChannel output;
    @Override
    public String send() {

        String string = UUID.randomUUID().toString();
        output.send(MessageBuilder.withPayload(string).build());
        System.out.println("************string:"+string);

        return  null;
    }
}
